package utils

import (
	"strings"
	"time"
)

type FormatTime time.Time

func (ct FormatTime) Now() FormatTime {
	panic("unimplemented")
}

func (ct *FormatTime) UnmarshalJSON(b []byte) error {
	s := strings.Trim(string(b), `"`)
	if s == "" || s == "null" {
		return nil
	}
	t, err := time.Parse("2006-01-02T15:04:05", s)
	if err != nil {
		return err
	}
	*ct = FormatTime(t)
	return nil
}
